//
//  DKHomeSourceView.m
//  DanKU
//
//  Created by 吴斌 on 2023/10/6.
//

#import "DKHomeSourceView.h"
@interface DKHomeSourceView()
@property (strong, nonatomic) UILabel *limitRemainLab;
@property (strong, nonatomic) UILabel *limitFrozenLab;
@property (strong, nonatomic) UILabel *limitUsedLab;
@end
@implementation DKHomeSourceView
-(instancetype)init{
    if(self == [super init]){
        self.backgroundColor = UIColor.clearColor;
        [self dk_addSubView];
    }
    return self;
}
- (void)dk_addSubView{
    //limitRemain
    self.limitRemainLab = [[UILabel alloc] init];
    self.limitRemainLab.textColor = DK_Hex(@"#746AFF");
    self.limitRemainLab.font = DK_FONT_Regular(16);
    self.limitRemainLab.text = @"₹ 0";
    self.limitRemainLab.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.limitRemainLab];
    [self.limitRemainLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(DK_IsWidthScale(15)));
        make.top.equalTo(@(DK_IsWidthScale(0)));
        make.height.equalTo(@(DK_IsWidthScale(22)));
    }];
    UILabel *dk_limitRemainHeadLab = [[UILabel alloc] init];
    dk_limitRemainHeadLab.textColor = DK_HexA(@"#999999", 0.9);
    dk_limitRemainHeadLab.font = DK_FONT_Regular(10);
    dk_limitRemainHeadLab.text = @"Limit Remaining";
    dk_limitRemainHeadLab.textAlignment = NSTextAlignmentCenter;
    [self addSubview:dk_limitRemainHeadLab];
    [dk_limitRemainHeadLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.limitRemainLab);
        make.right.equalTo(self.limitRemainLab);
        make.top.equalTo(self.limitRemainLab.mas_bottom);
        make.bottom.equalTo(@(DK_IsWidthScale(0)));
    }];
    //limitFrozen
    self.limitFrozenLab = [[UILabel alloc] init];
    self.limitFrozenLab.textColor = DK_Hex(@"#FF54C2");
    self.limitFrozenLab.font = DK_FONT_Regular(16);
    self.limitFrozenLab.text = @"₹ 0";
    self.limitFrozenLab.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.limitFrozenLab];
    [self.limitFrozenLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.limitRemainLab.mas_right);
        make.top.equalTo(@(DK_IsWidthScale(0)));
        make.height.equalTo(@(DK_IsWidthScale(22)));
        make.width.equalTo(self.limitRemainLab.mas_width);
    }];
    UILabel *dk_limitFrozenHeadLab = [[UILabel alloc] init];
    dk_limitFrozenHeadLab.textColor = DK_HexA(@"#999999", 0.9);
    dk_limitFrozenHeadLab.font = DK_FONT_Regular(10);
    dk_limitFrozenHeadLab.text = @"Limit Frozen";
    dk_limitFrozenHeadLab.textAlignment = NSTextAlignmentCenter;
    [self addSubview:dk_limitFrozenHeadLab];
    [dk_limitFrozenHeadLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.limitFrozenLab);
        make.right.equalTo(self.limitFrozenLab);
        make.top.equalTo(self.limitFrozenLab.mas_bottom);
        make.bottom.equalTo(@(DK_IsWidthScale(0)));
    }];
    //limitUsed
    self.limitUsedLab = [[UILabel alloc] init];
    self.limitUsedLab.textColor = DK_Hex(@"#00CBFF");
    self.limitUsedLab.font = DK_FONT_Regular(16);
    self.limitUsedLab.text = @"₹ 0";
    self.limitUsedLab.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.limitUsedLab];
    [self.limitUsedLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.limitFrozenLab.mas_right);
        make.right.equalTo(@(-DK_IsWidthScale(15)));
        make.top.equalTo(@(DK_IsWidthScale(0)));
        make.height.equalTo(@(DK_IsWidthScale(22)));
        make.width.equalTo(self.limitFrozenLab);
    }];
    UILabel *dk_limitUsedHeadLab = [[UILabel alloc] init];
    dk_limitUsedHeadLab.textColor = DK_HexA(@"#999999", 0.9);
    dk_limitUsedHeadLab.font = DK_FONT_Regular(10);
    dk_limitUsedHeadLab.text = @"Limit Used";
    dk_limitUsedHeadLab.textAlignment = NSTextAlignmentCenter;
    [self addSubview:dk_limitUsedHeadLab];
    [dk_limitUsedHeadLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.limitUsedLab);
        make.right.equalTo(self.limitUsedLab);
        make.top.equalTo(self.limitUsedLab.mas_bottom);
        make.bottom.equalTo(@(DK_IsWidthScale(0)));
    }];
}
-(void)setLimitRemain:(NSString *)limitRemain{
    _limitRemain = limitRemain;
    self.limitRemainLab.text = [NSString stringWithFormat:@"₹%@",[NSString makeShowMoney:_limitRemain]];
}
-(void)setLimitFrozen:(NSString *)limitFrozen{
    _limitFrozen = limitFrozen;
    self.limitFrozenLab.text = [NSString stringWithFormat:@"₹%@",[NSString makeShowMoney:_limitFrozen]];
}
-(void)setLimitUserd:(NSString *)limitUserd{
    _limitUserd = limitUserd;
    self.limitUsedLab.text = [NSString stringWithFormat:@"₹%@",[NSString makeShowMoney:_limitUserd]];
}
@end
